var n = new (require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../DPagination")).default)("incomeList"), e = getApp();

Page({
    data: {
        incomeList: {},
        earningsThisMonth: 0,
        remainingBonus: 0,
        personalRanking: "暂未上榜",
        platformReward: 0,
        customSettings: {
            rankingName: "排行榜",
            expectedEarningText: 0
        },
        memberInfo: null
    },
    onLoad: function(e) {
        n.bind(this), n.clean(), this.loadIncomeData();
    },
    onPullDownRefresh: function() {
        n.clean(), this.loadIncomeData();
    },
    onReachBottom: function() {
        this.loadIncomeData();
    },
    onShareAppMessage: function() {},
    onShareTimeline: function() {},
    loadIncomeData: function() {
        var a = this;
        if (!n.loading && !n.finished) {
            wx.showLoading({
                title: "加载中",
                mask: !0
            }), n.loading = !0;
            var i = e.getNetAddresss("plugin.commission-ranking.api.get-commission-ranking.index");
            e._getNetWork({
                url: i,
                data: {
                    page: n.loadPage
                },
                success: function(e) {
                    var i = e.data, t = i.result, o = i.msg, s = i.data;
                    if (0 != t) {
                        s.data.length < n.limit && (n.finished = !0), n.limit != s.per_page && (n.limit = s.per_page), 
                        n.push(s.data), s.plugin_name != a.data.customSettings.pageTitle && wx.setNavigationBarTitle({
                            title: s.plugin_name
                        });
                        var r = {
                            earningsThisMonth: s.my_profit,
                            remainingBonus: s.allocated,
                            customSettings: {
                                rankingName: s.profit_name || "排行榜",
                                expectedEarningText: s.estimate_profit_name || "本月预计收益",
                                pageTitle: s.plugin_name || "排行榜"
                            }
                        };
                        s.personal_ranking && (s.personal_ranking = parseInt(s.personal_ranking), s.personal_ranking && (r.personalRanking = "第" + s.personal_ranking + "名")), 
                        null === a.data.memberInfo && (r.memberInfo = s.member), a.setData(r), n.loading = !1, 
                        wx.hideLoading(), wx.stopPullDownRefresh();
                    } else wx.showToast({
                        title: o,
                        icon: "none"
                    });
                }
            });
        }
    }
});